from django.contrib import admin
from django.urls import path,re_path
from django.conf.urls import url,include
from django.views.generic import TemplateView
from . import views as product_views

from django.conf import settings

app_name='product'
urlpatterns = [
    path('category/list', product_views.CategoryListPageView.as_view(), name='show_categoryList'),
    path('category/add', product_views.CategoryAddPageView.as_view(), name='show_categoryAdd'),
    path('category/<int:pk>/delete', product_views.CategoryDelPageView.as_view(), name='show_categoryDel'),
    path('category/<int:pk>/update', product_views.CategoryUpdatePageView.as_view(), name='show_categoryUpdate'),
    path('category/<int:pk>/detail', product_views.CategoryDetailPageView.as_view(), name='show_categoryDetail'),

    path('product/list', product_views.ProductListPageView.as_view(), name='show_productList'),
    path('product/add', product_views.ProductAddPageView.as_view(), name='show_productAdd'),
    path('product/<int:pk>/delete', product_views.ProductDelPageView.as_view(), name='show_productDel'),
    path('product/<int:pk>/update', product_views.ProductUpdatePageView.as_view(), name='show_productUpdate'),
    path('associate/order/<int:pk>', product_views.ProductAssociateOrder.as_view(), name='show_productAssociateOrder'),
    path('associate/customer/<int:pk>', product_views.ProductAssociateCustomer.as_view(), name='show_productAssociateCustomer'),
    ##修改记录时有两种方式
    ##一是先用DetailView类获取要修改的对象将对象的数据回显到修改表单中,再使用UpdateView类去更新对象
    ##二是直接使用UpdateView类对象,在XXX_UpdateView类中添加一个获取对象的函数即可(get_context_data)
]
